Positioning the items |
There are two different ways to define the position of the items in the window. The easier way is to use the x, y, w and h attributes to define the absolute coordinates and the width and height of the item. It is also possible to use the origin attribute to define the point of origin for the x and y coordinates. For example if you set the origin="TOP-RIGHT" it means the the x coordinate is relative to the right edge of the window instead of left like it normally would be. So, to make the item inside the window you need to use negative coordinates. See the example below. The second way to define the item position is to use x1, y1, x2 and y2 to define the two corners of the position rectangle. The benefit from this is that both coordinates can use different points of origin (origin1 and origin2). If you for example want to have an image that covers the whole window you can set origin1="TOP-LEFT" and origin2="BOTTOM-RIGHT" and both coordinates to zero. See below for another example. You may not mix the two different ways to define the position. If you use the x1 and y1 attributes you cannot use w and h to define the dimensions. It is also possible to make the coordinates relative to the previous item. To do this you need to add 'r' after the coordinate. E.g. x1="10r". Note that in this situation the point of origin is relative to the previous item's position and not the window's corners like it normally is. You can also mix the relative and absolute coordinates if necessary. Below is an example which hopefully clarifies the relative coordinate system. The item alignment can be tricky sometimes as it can be intepreted two ways. If the item's position is defined by a rectangle the align attribute defines the item's position within the rectangle. E.g. align="BOTTOM-LEFT" would put the item to the bottom left corner of the position rectangle. If the position of the item is defined by just a point, the align attribute defines the where the point is located relative to the item. For example align="BOTTOM-LEFT" would draw the item so that the item's location point would be in the bottom left corner of the item. See the below image if the explanation didn't make any sense. The size of the window is calculated automatically from the item dimensions. However this might not be possible in all situations so you sometimes the height and width of the window must be specified explicitely. |